import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import MainPage from '../component/main/Main';
import { listenDrag } from '../actions/init';
import { editTag } from '../actions/editTag';
import { pickPoint } from '../actions/pickPoint';
import { changeInput } from '../actions/changeInputArr';
import { insertMarkPoint } from '../actions/insertMarkPoint';

class MainContainer extends React.Component {
  render() {
    return (
      <MainPage
        {...this.props}
      />
    );
  }
}

function mapStateToProps(state) {
  const { folderTree, jsonTree, markItem, pickEvent } = state.main;
  return {
    folderTree,
    jsonTree,
    markItem,
    pickEvent,
  };
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators({
    listenDrag,
    editTag,
    pickPoint,
    changeInput,
    insertMarkPoint
  }, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(MainContainer);
